# 0. 导包
import unittest
import requests


class TestAPI(unittest.TestCase):
    # activity_name = "测试活动" + str(random.randint(100000000000, 00000000000000))
    headers = {'Content-Type': "application/x-www-form-urlencoded",
               "token": "285190856c62416897ba2b2ffdce3d00",
               "appid": "wx6ee906fbaa89d8b0",
               "invokepoolcode": "activity_mini_app"
               }

    def test_activity_list(self):
        """"access_token": "5ffc11360c6e4d4e961e8123c3661803"
        活动首页报名列表
        :return:
        """
        # 1. 设置资源路径 - 定位接口资源
        url = BASE_URL + "vega-server/help/home/exchangeMoney"
        # headers = {"access_token": "5ffc11360c6e4d4e961e8123c3661803",
        #     "Content - Type":"multipart/form-data;boundary = --------------------------461551252756657838079235"
        # }

        data = {
            "id": "104",
            "pageNumber": "1",
            "pageSize": "5",
            "userid": "136981",
                }
        # data["name"] = activity_name
        # 2. 设置提交数据,发送请求
        # 查询所有 无请求数据
        response = requests.get(url, headers=self.headers, data=data)
        response.encoding = "utf-8"
        # 3 查看响应结果
        # 3.1 查看状态码
        code = response.status_code
        print(code)
        # 3.2 查看返回结果文本格式  字符串
        text = response.json()
        print(text)
